﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace FontTool
{

    public abstract class commandGlyph
    {
        public abstract void Execute(nCharacter nchar);
        public abstract void Undo(nCharacter nchar);
        public abstract void Redo(nCharacter nchar);
    }

    class glyphAnchorCommand : commandGlyph
    {
        private PointF previousValue;
        private PointF newValue;

        public glyphAnchorCommand(PointF current, PointF value)
        {
            previousValue = current;
            newValue = value;
        }

        public override void Execute(nCharacter nchar)
        {
            nchar._AnchorPoint = newValue;
            Console.WriteLine(@"glyphAnchorCommand\Execute: " + newValue); 
        }

        public override void Undo(nCharacter nchar)
        {
            nchar._AnchorPoint = previousValue;
            Console.WriteLine(@"glyphAnchorCommand\Undo: " + previousValue); 
        }

        public override void Redo(nCharacter nchar)
        {
            nchar._AnchorPoint = newValue;
            Console.WriteLine(@"glyphAnchorCommand\Redo: " + newValue); 
        }
    }

    class glyphWidthCommand : commandGlyph
    {
        private float previousValue;
        private float newValue;

        public glyphWidthCommand(float current, float value)
        {
            previousValue = current;
            newValue = value;
        }

        public override void Execute(nCharacter nchar)
        {
            nchar._Width = newValue;
            Console.WriteLine(@"glyphWidthCommand\Execute: " + newValue); 
        }

        public override void Undo(nCharacter nchar)
        {
            nchar._Width = previousValue;
            Console.WriteLine(@"glyphWidthCommand\Undo: " + previousValue); 
        }

        public override void Redo(nCharacter nchar)
        {
            nchar._Width = newValue;
            Console.WriteLine(@"glyphWidthCommand\Redo: " + newValue); 
        }
    }
}
